class BlogController < ApplicationController
  layout "home"
  before_filter :clear_session
  
  def index
    @last_five = Post.last_five
    @recent = Post.recent
  end
  
  def show
    @post = Post.find(params[:id])
    @comments = @post.comments
    @recent = Post.recent
  end
  
  def whole_blog
    @posts = Post.find(:all)
    respond_to do |format|
      format.html { respond_to :action => 'index'}
      format.js
    end
  end
  
  def comment
    @post = Post.find(params[:id])
    @comment = @post.comments.create(params[:comment])
    respond_to do |format|
      format.html { respond_to :action => 'show'}
      format.js
    end
  end
end
